<?php

namespace app\http;

use app\admin\model\Token;
use think\facade\Request;

trait GetUid
{
    public static function getUId($token = '')
    {
        if (empty($token)) {
            $token = Request::header('Authorization');
        }
        return Token::where('token', $token)->find()['uid'];
    }
}
